home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 26 / PC Gamer IT CD 26 1-2.iso / MEDIA / NET.DXR / Internal_2_UtilityHandlers.ls < prev    next >
Encoding:
Text File  |  1997-11-05  |  3.7 KB  |  158 lines

  1. on openP
  2.   global DBfact, TBfact
  3.   set DBfact to xtra("V12Dbe")
  4.   set TBfact to xtra("V12Table")
  5. end
  6.  
  7. on createDB
  8.   global DBfact
  9.   set gDb to new(DBfact, the pathName & "shareW.db", "cr", "imagine")
  10.   mCreateTable(gDb, "shareware")
  11.   put mCreateField(gDb, "shareware", "category", "String", 255)
  12.   put mCreateField(gDb, "shareware", "name", "String", 255)
  13.   put mCreateField(gDb, "shareware", "description", "String", 3400)
  14.   put mCreateField(gDb, "shareware", "filepath", "String", 255)
  15.   put mCreateField(gDb, "shareware", "url", "String", 255)
  16.   put mCreateField(gDb, "shareware", "contact", "String", 2000)
  17.   put mCreateIndex(gDb, "shareware", "catIdx", "d", "category", "a")
  18.   put mCreateIndex(gDb, "shareware", "nameIdx", "d", "name", "a")
  19.   put mBuild(gDb)
  20.   set gDb to 0
  21. end
  22.  
  23. on openDB
  24.   global DBfact, TBfact, gDb, gTB
  25.   set gDb to new(DBfact, the pathName & "shareW.db", "ReadWrite", "imagine")
  26.   set gTB to new(TBfact, mGetRef(gDb), "shareware")
  27. end
  28.  
  29. on Import
  30.   global DBfact, TBfact, gDb, gTB
  31.   put mImportFile(gTB, the pathName & "shareW.txt", TAB, RETURN)
  32. end
  33.  
  34. on setOne
  35.   global gTB
  36.   put mAddRecord(gTB)
  37.   put mSetField(gTB, "AppName", "BoneHead")
  38.   put mSetField(gTB, "url", "www.wiredplanet.com")
  39.   put mUpdateRecord(gTB)
  40. end
  41.  
  42. on getOne
  43.   global gTB
  44.   put mGetField(gTB, "name", 1, 2)
  45. end
  46.  
  47. on listIt
  48.   global gTB
  49.   put EMPTY into field "theList"
  50.   set n to mSelectCount(gTB)
  51.   repeat with i = 1 to n
  52.     put mGetField(gTB, "category", "category") after field "theList"
  53.     mGoNext(gTB)
  54.   end repeat
  55. end
  56.  
  57. on closeP
  58.   global gTB, gDb
  59.   set gTB to 0
  60.   set gDb to 0
  61. end
  62.  
  63. on CreateIt
  64.   openP()
  65.   createDB()
  66.   openDB()
  67.   Import()
  68.   closeP()
  69. end
  70.  
  71. on showSelection
  72.   global gTB
  73.   cursor(4)
  74.   set n to mSelectCount(gTB)
  75.   put n into field "totalCount"
  76.   set temp to mGetPosition(gTB)
  77.   mGoFirst(gTB)
  78.   put EMPTY into field "zlist"
  79.   set dummy to EMPTY
  80.   repeat with i = 1 to n
  81.     set nm to mGetField(gTB, "name")
  82.     put nm & RETURN after dummy
  83.     mGoNext(gTB)
  84.   end repeat
  85.   put dummy into field "zlist"
  86.   mGo(gTB, temp)
  87.   updateDisplay()
  88.   cursor(-1)
  89. end
  90.  
  91. on updateDisplay
  92.   global gTB
  93.   set i to mGetPosition(gTB)
  94.   set the foreColor of field "zlist" to 255
  95.   set the foreColor of line i of field "zlist" to 1
  96.   put mGetField(gTB, "name") into field "Name"
  97.   put mGetField(gTB, "description") into field "zdesc"
  98.   put mGetField(gTB, "contact") into field "zspecial"
  99.   put mGetField(gTB, "url") into field "zurl"
  100.   put mGetField(gTB, "filepath") into field "Path"
  101. end
  102.  
  103. on domSelectCount
  104.   global gTB
  105.   put mSelectCount(gTB) into field "totalCount"
  106. end
  107.  
  108. on CheckError errCode, msg
  109.   global gDb
  110.   if errCode <> 0 then
  111.     if objectp(gDb) then
  112.       set errTxt to mError(gDb, errCode)
  113.     else
  114.       set errText to "unknown error"
  115.     end if
  116.     alert("Error" && errCode && "(" & errTxt & ") occured at" && msg)
  117.   end if
  118. end
  119.  
  120. on TrackClick
  121.   set spriteNum to the clickOn
  122.   set offCast to the castNum of sprite spriteNum
  123.   set onCast to offCast + 1
  124.   set the castNum of sprite spriteNum to onCast
  125.   updateStage()
  126.   repeat while the mouseDown
  127.     if rollOver(spriteNum) then
  128.       set the castNum of sprite spriteNum to onCast
  129.     else
  130.       set the castNum of sprite spriteNum to offCast
  131.     end if
  132.     updateStage()
  133.   end repeat
  134.   set the castNum of sprite spriteNum to offCast
  135.   updateStage()
  136.   return rollOver(spriteNum)
  137. end
  138.  
  139. on getdrive
  140.   set curpath to the moviePath
  141.   set olddelimiter to the itemDelimiter
  142.   set the itemDelimiter to "\"
  143.   set drive to item 1 of curpath & "\"
  144.   set the itemDelimiter to olddelimiter
  145.   return drive
  146. end
  147.  
  148. on restartMe
  149.   global DBfact, TBfact
  150.   clearGlobals()
  151.   openXLib(the pathName & "xtras:V12Dbe")
  152.   openXLib(the pathName & "xtras:V12Table")
  153.   set DBfact to xtra("V12Dbe")
  154.   set TBfact to xtra("V12Table")
  155.   set the visible of sprite 47 to 0
  156.   put "All Shareware" into field "fld"
  157. end
  158.